/*
	H5获取链接中的参数
	https://blog.csdn.net/L1147484597/article/details/124386613
	
	在H5页面上获取URL携带参数
	https://blog.csdn.net/Eric_xkk/article/details/120153125
	
	H5获取链接中的参数
	https://blog.csdn.net/L1147484597/article/details/124386613
	
	JS中var、let以及const关键字到底怎么用？
	https://blog.csdn.net/weixin_53614367/article/details/123673400
	
	var、let、const的区
	https://jingyu1205.blog.csdn.net/article/details/127034023
	
	移动端H5点击按钮复制指定的文本至手机的剪切板
	https://www.freesion.com/article/7172932709/
	
	H5复制内容到剪切板
	https://blog.csdn.net/qq_40088412/article/details/121946393
*/
function getUrlParm(){
   const url = new URL(window.location.href);//检测到是自己页面url
	   console.log("检测的url："+url);
	   const urlParams = url.searchParams;
	   console.log("urlParams = "+urlParams)
	   if(urlParams == null || urlParams == ""){
		   console.log("urlParams为空")
			return
	   }
	   const ucode = urlParams.get('ucode');
	   console.log("ucode = "+ucode);
	   
	   /*
	     读写剪切板 系统 剪切板 navigator.clipboard.writeText(inputVal)
		 https://www.cnblogs.com/papering/p/9533182.html
		 https://developer.mozilla.org/zh-CN/docs/Web/API/ClipboardEvent/clipboardData
		 
		 Navigator.clipboard
		 https://blog.51cto.com/u_15061941/4565131
	   */
	   navigator.clipboard.writeText(ucode)
	           .then(() => {
	               console.log('复制成功');
	           })
	           .catch((error) => {
	               console.error('复制失败: ', error);
	           });

}

function getUrlParm2(){
	
	// var url = location.search
		console.log("检测的url："+url);
		//检测的url：?ucode=124125
		
	const urlParams = new URLSearchParams(window.location.search);
	const ucode = urlParams.get('ucode');
	console.log("ucode = "+ucode);
	
	if (url.indexOf("?") != -1){
		
	}
}